package com.venusj.juc;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author venusj
 * @date 2021/3/19
 */
public class AQSDemo {

    public static void main(String[] args) {
        /**
         * 默认构造函数  为非公平锁
         * ture: 为公平锁
         * false: 为非公平锁
         */
        ReentrantLock lock = new ReentrantLock(true);
        try {
            lock.lock();
            System.out.println("业务逻辑处理");
        }
        finally {
            lock.unlock();
        }
        boolean interrupted = false;

        boolean interrupted1 = Thread.interrupted();
        interrupted |= interrupted1;
        System.out.println("interrupted:" + interrupted);
        System.out.println("interrupted1:" + interrupted1);
    }
}
